<template>
  <div class="head">
    <div class="title">有偿流量流向报表</div>
    <div class="line" />
    <el-row>
      <el-col :span="24">
        <div class="title1">
          <el-form ref="form" style="display: flex;flex-wrap: wrap;margin-top: 24px;justify-content: space-between;" :model="form" label-width="80px">
            <el-form-item class="text" label="日期">
              <el-date-picker
                v-model="value1"
                class="input1"
                type="daterange"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              />
            </el-form-item>
            <el-form-item style="margin-left: 0;" class="text" label="展示维度">
              <el-select v-model="form.region" class="input" placeholder="请选择">
                <el-option label="区域一" value="shanghai" />
                <el-option label="区域二" value="beijing" />
              </el-select>
            </el-form-item>
            <el-form-item class="text" label="时间维度">
              <el-select v-model="form.region" class="input" placeholder="请选择">
                <el-option label="区域一" value="shanghai" />
                <el-option label="区域二" value="beijing" />
              </el-select>
            </el-form-item>

            <div>
              <el-form-item>
                <el-button type="primary" @click="onSubmit">查询</el-button>
                <el-button>重置</el-button>
              </el-form-item>
            </div>
          </el-form>
        </div>
        <div class="title1">
          <el-form ref="form" style="display: flex;justify-content: space-between;flex-wrap: wrap;" :model="form" label-width="80px">
            <div style="display: flex;flex-wrap: wrap;">
              <el-form-item class="text" label="始发机构">
                <el-select v-model="form.region" class="input" placeholder="请选择">
                  <el-option label="区域一" value="shanghai" />
                  <el-option label="区域二" value="beijing" />
                </el-select>
              </el-form-item>
              <el-form-item class="text" label="始发片区">
                <el-select v-model="form.region" class="input" style="width: 216px;" placeholder="输入关键字后自动搜索">
                  <el-option label="区域一" value="shanghai" />
                  <el-option label="区域二" value="beijing" />
                </el-select>
              </el-form-item>
              <el-form-item class="text" label="省份">
                <el-select
                  v-model="mxForm.destinationProvince"
                  class="input"
                  placeholder="输入关键字后自动搜索"
                  style="width: 216px;"
                  @change="provinceChange"
                >
                  <el-option
                    v-for="item in ProvinceList"
                    :key="item.id"
                    :label="item.province"
                    :value="{ pid: item.pid, province: item.province }"
                  />
                </el-select>
              </el-form-item>
              <el-form-item class="text" label="城市">
                <el-select
                  v-model="mxForm.destinationCity"
                  class="input"
                  placeholder="输入关键字后自动搜索"
                  style="width: 216px;"
                >
                  <el-option
                    v-for="item in cityList"
                    :key="item.id"
                    :label="item.city"
                    :value="item.city"
                  />
                </el-select>
              </el-form-item>
              <el-form-item class="text" label="网点">
                <el-select v-model="form.region" class="input" placeholder="输入关键字后自动搜索">
                  <el-option label="区域一" value="shanghai" />
                  <el-option label="区域二" value="beijing" />
                </el-select>
              </el-form-item>
            </div>
            <div>
              <el-form-item>
                <el-button @click="onSubmit"><i class="el-icon-upload2" />导出</el-button>
              </el-form-item>
            </div>
          </el-form>
        </div>
        <div class="title1">
          <el-form ref="form" style="display: flex;justify-content: space-between;flex-wrap: wrap;" :model="form" label-width="80px">
            <div style="display: flex;flex-wrap: wrap;">
              <el-form-item class="text" label="目的机构">
                <el-select v-model="form.region" class="input" placeholder="请选择">
                  <el-option label="区域一" value="shanghai" />
                  <el-option label="区域二" value="beijing" />
                </el-select>
              </el-form-item>
              <el-form-item class="text" label="始发片区">
                <el-select v-model="form.region" class="input" style="width: 216px;" placeholder="输入关键字后自动搜索">
                  <el-option label="区域一" value="shanghai" />
                  <el-option label="区域二" value="beijing" />
                </el-select>
              </el-form-item>
              <el-form-item class="text" label="省份">
                <el-select
                  v-model="mxForm.destinationProvince"
                  class="input"
                  placeholder="输入关键字后自动搜索"
                  style="width: 216px;"
                  @change="provinceChange"
                >
                  <el-option
                    v-for="item in ProvinceList"
                    :key="item.id"
                    :label="item.province"
                    :value="{ pid: item.pid, province: item.province }"
                  />
                </el-select>
              </el-form-item>
              <el-form-item class="text" label="城市">
                <el-select
                  v-model="mxForm.destinationCity"
                  class="input"
                  placeholder="输入关键字后自动搜索"
                  style="width: 216px;"
                >
                  <el-option
                    v-for="item in cityList"
                    :key="item.id"
                    :label="item.city"
                    :value="item.city"
                  />
                </el-select>
              </el-form-item>
              <el-form-item class="text" label="网点">
                <el-select v-model="form.region" class="input" placeholder="输入关键字后自动搜索">
                  <el-option label="区域一" value="shanghai" />
                  <el-option label="区域二" value="beijing" />
                </el-select>
              </el-form-item>
            </div>
            <div />
          </el-form>
        </div>
        <div class="title1">
          <el-form ref="form" style="display: flex;justify-content: space-between;flex-wrap: wrap;" :model="form">
            <div style="display: flex;flex-wrap: wrap;">
              <el-form-item style="display: flex;margin-left: 10px;" class="text" label="面单类型">
                <el-select v-model="form.region" class="input" placeholder="请选择">
                  <el-option label="区域一" value="shanghai" />
                  <el-option label="区域二" value="beijing" />
                </el-select>
              </el-form-item>
              <el-form-item style="display: flex;margin-left: 16px;" class="text" label="政策剔除件量">
                <el-select v-model="form.region" class="input" placeholder="请选择">
                  <el-option label="区域一" value="shanghai" />
                  <el-option label="区域二" value="beijing" />
                </el-select>
              </el-form-item>
            </div>
          </el-form>
        </div>
        <div class="title3">
          <div style="display: flex;flex-wrap: wrap;">
            <div class="text">
              <span class="span">*</span>
              <span class="text1">起始重量</span>
              <el-input-number v-model="num" class="number" controls-position="right" :min="1" @change="handleChange" />
              <span style="margin-left: 13px;">kg</span>
            </div>
            <div class="text" style="margin-left: 30px;">
              <span class="span">*</span>
              <span class="text1">结束重量</span>
              <el-input-number v-model="num1" class="number" controls-position="right" :min="1" @change="handleChange" />
              <span style="margin-left: 13px;">kg</span>
            </div>
            <div class="text2">
              <el-radio v-model="radio" label="1">包首</el-radio>
              <el-radio v-model="radio" label="2">包末</el-radio>
            </div>
          </div>
          <div style="display: flex;">
            <button class="bt" style="margin-right: 16px;" @click="add">添加重量段</button>
            <button class="bt" @click="dele">删除重量段</button>
          </div>
        </div>
        <div v-for="i in list" :key="i" class="title3">
          <div style="display: flex;flex-wrap: wrap;">
            <div class="text">
              <span class="span">*</span>
              <span class="text1">起始重量</span>
              <el-input-number v-model="num" class="number" controls-position="right" :min="1" @change="handleChange" />
              <span style="margin-left: 13px;">kg</span>
            </div>
            <div class="text" style="margin-left: 30px;">
              <span class="span">*</span>
              <span class="text1">结束重量</span>
              <el-input-number v-model="num1" class="number" controls-position="right" :min="1" @change="handleChange" />
              <span style="margin-left: 13px;">kg</span>
            </div>
            <div class="text2">
              <el-radio v-model="radio" label="1">包首</el-radio>
              <el-radio v-model="radio" label="2">包末</el-radio>
            </div>
          </div>
        </div>
        <el-table
          :data="tableData"
          :header-cell-style="{ background: '#f6f6f6' }"
          style="width: 100%;height: 575px;"
        >
          <el-table-column
            prop="date"
            label=""
            align="center"
          />
          <el-table-column
            prop="date"
            label="结算日期"
            align="center"
          />
          <el-table-column label="始发机构" align="center">
            <el-table-column label="始发片区" align="center" />
            <el-table-column label="始发省份" align="center" />
            <el-table-column label="始发城市" align="center" />
            <el-table-column label="始发上级网点编码" align="center" />
            <el-table-column label="始发上级网点编码" align="center" />
          </el-table-column>
          <el-table-column label="目的机构" align="center">
            <el-table-column label="始发片区" align="center" />
            <el-table-column label="始发省份" align="center" />
            <el-table-column label="始发城市" align="center" />
            <el-table-column label="始发上级网点编码" align="center" />
            <el-table-column label="始发上级网点编码" align="center" />
          </el-table-column>
        </el-table>
        <div style="display: flex;justify-content: space-between;margin-top: 51px;">
          <div class="title2">显示2到2，共2记录</div>
          <div class="block" style="display: flex; justify-content: flex-end">
            <el-pagination
              background
              :current-page="currentPage4"
              :page-sizes="[10, 20, 30, 40]"
              :page-size="10"
              layout="prev, pager, next,sizes"
              :total="khTotal"
              prev-text="上一页"
              next-text="下一页"
              @size-change="khHandleSizeChange"
              @current-change="khHandleCurrentChange"
            />
          </div>
        </div>

      </el-col>
    </el-row>
  </div>
</template>

<script>
import { getCityId, getProvinceList } from '@/api/dashboard'

export default {

  components: {},
  data() {
    return {
      list: 0,
      radio: '1',
      num: 1,
      num1: 1,
      value1: '',
      ProvinceList: [], // 省
      cityList: [], // 市
      mxForm: {
        destinationProvince: '',
        destinationCity: ''
      },
      form: {
        name: '',
        region: '',
        date1: '',
        date2: '',
        delivery: false,
        type: [],
        resource: '',
        desc: ''
      },
      tableData: [{
        date: '2016-05-02',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-04',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1517 弄'
      }, {
        date: '2016-05-01',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1519 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }]
    }
  },

  computed: {},

  created() {
    this.getProvince()
  },

  methods: {
    // 获取省
    getProvince() {
      getProvinceList().then((res) => {
        if (res.code === 200) {
          this.ProvinceList = res.data
        }
      })
    },
    // 获取省的id
    provinceChange(value) {
      console.log(value)
      this.mxForm.destinationProvince = value.province
      this.getCity(value.pid)
    },
    getCity(pid) {
      getCityId(pid).then((res) => {
        if (res.code === 200) {
          this.cityList = res.data
        }
      })
    },
    handleChange(value) {
      console.log(value)
    },
    // 添加重量段
    add() {
      this.list++
    },
    // 删除重量段
    dele() {
      this.list--
    }
  }
}

</script>
<style  scoped lang="scss">
.head{
  padding: 30px;
}
.title{
  font-size: 16px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #666666;
}
.line{
  height: 1px;
background: #D8D8D8;
border-radius: 1px;
margin-top: 19px;
}
.title1{
  // display: flex;
  // justify-content: space-between;
  .text{
    font-size: 18px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #666666;
// margin-left: 52px;
.input{
  width: 286px;
height: 36px;
background: #FFFFFF;
// border: 1px solid #B4B4B4;
border-radius: 4px;
}
.input1{
  width: 708px;
height: 36px;
background: #FFFFFF;
border: 1px solid #B4B4B4;
border-radius: 4px;
}
  }
}
.title2{
  font-size: 18px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #666666;
}
.title3{
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  .span{
    color:red
  }
  .text1{
    font-size: 18px;
font-family: Source Han Sans CN;
font-weight: 400;
margin-left: 3px;
  }
  .number{
    width: 128px;
background: #FFFFFF;
border-radius: 4px;
margin-left: 12px;
  }
  .text2{
    margin-top: 13px;
    margin-left: 20px;
  }
  .bt{
    width: 120px;
height: 36px;
background: #FFFFFF;
border: 1px solid #B4B4B4;
border-radius: 4px;
  }
}
</style>
